import XCTest
import RxSwift
@testable import RxDataParser

final class RxDataParserTests: XCTestCase {
    private let disposeBag = DisposeBag()

    func testExample() throws {
   
        struct User: Decodable {
            let id: Int
            let name: String
            let email: String
        }

        let jsonString = """
        {
            "id": 1,
            "name": "John Doe",
            "email": "john@example.com"
        }
        """
        
        let person = DataParser()
        person.parse(jsonString).subscribe(onNext: { (urer: User) in
            print("解析成功: \(urer.name)")
        },onError: { error in
            print("解析失败: \(error)")
        }).disposed(by: disposeBag)
        
        
    }
}
